<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <p></p>
    <script>
        const xhr = new XMLHttpRequest()
        xhr.open('GET', 'http://hmajax.itheima.net/api/city?pname=河北省')
        xhr.addEventListener('loadend', () => {
            console.log(xhr.response)
            document.querySelector('p').innerHTML = xhr.response
            const data = JSON.parse(xhr.response)
            console.log(data.list.join('<br>'))
            document.querySelector('p').innerHTML = data.list.join('<br>')
        })
        xhr.send()
    </script>

</body>

</html>